Help editor integrations rewrite Markdown tables without drifting or hanging - #2
Open
dnouri wants to merge 1 commit into
Open
Help editor integrations rewrite Markdown tables without drifting or hanging#2dnouri wants to merge 1 commit into
dnouri wants to merge 1 commit into
Conversation
dnouri
force-pushed
the
helper-table-inspection
branch
from
March 16, 2026 09:40
59759cd to
4d7d7cb
Compare
…hanging Markdown table wrapping is most useful when editor commands can apply it repeatedly to source buffers. Until now that path was awkward and easy to get wrong. Callers had to rediscover table boundaries themselves, guess whether they were looking at source or already-wrapped output, preserve indentation and trailing newlines by hand, and hope they were not sitting at EOF or inside a fenced block. Even when helper code found the right block, wrapped-looking pipe tables with multi-line headers or continuation-style values could still lose structure on rewrite. The README mirrored that brittleness by spelling out the same low-level replacement dance in each recipe. Teach the library the editor-facing operations it was missing. Give it a way to find pipe-table blocks in buffers while skipping fenced code blocks, normalize same-width wrapped output back to source form, and format extracted table blocks so repeated rewrites preserve indentation, newline shape, and recoverable wrapped structure. Merge visual header rows before the separator instead of discarding all but the last one, so helper-driven rewrites keep wrapped-like header content intact. That gives wrapping at point, buffer-wide cleanup, and save-hook workflows one safe path instead of several fragile ones. Rewrite the integration documentation around that safer path and back it with coverage for EOF tables, region discovery, idempotent same-width rewrites, indentation-preserving reinsertions, README-driven editing flows, and pseudo-table blocks with multi-line headers or continuation rows. The result is a table wrapper that behaves predictably in real editing sessions instead of asking every caller to reconstruct its edge cases from scratch.
dnouri
force-pushed
the
helper-table-inspection
branch
from
March 16, 2026 10:45
4d7d7cb to
e05ef6f
Compare
Contributor
|
Nice — this is exactly the editor-facing API a display-overlay library wants. FWIW I'm working on a read-only pretty table renderer (display overlays over canonical source, toggled like |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Markdown table wrapping is most useful when editor commands can apply it
repeatedly to source buffers. Until now that path was awkward and easy
to get wrong. Callers had to rediscover table boundaries themselves,
guess whether they were looking at source or already-wrapped output,
preserve indentation and trailing newlines by hand, and hope they were
not sitting at EOF or inside a fenced block. Even when helper code
found the right block, wrapped-looking pipe tables with multi-line
headers or continuation-style values could still lose structure on
rewrite. The README mirrored that brittleness by spelling out the same
low-level replacement dance in each recipe.
Teach the library the editor-facing operations it was missing. Give it
a way to find pipe-table blocks in buffers while skipping fenced code
blocks, normalize same-width wrapped output back to source form, and
format extracted table blocks so repeated rewrites preserve indentation,
newline shape, and recoverable wrapped structure. Merge visual header
rows before the separator instead of discarding all but the last one, so
helper-driven rewrites keep wrapped-like header content intact. That
gives wrapping at point, buffer-wide cleanup, and save-hook workflows
one safe path instead of several fragile ones.
Rewrite the integration documentation around that safer path and back it
with coverage for EOF tables, region discovery, idempotent same-width
rewrites, indentation-preserving reinsertions, README-driven editing
flows, and pseudo-table blocks with multi-line headers or continuation
rows. The result is a table wrapper that behaves predictably in real
editing sessions instead of asking every caller to reconstruct its edge
cases from scratch.